﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Xml.Linq;

namespace CoreEx.Common.Serialization
{
    /// <summary>
    /// Represents a class that is capable of serializing and deserializing an <see cref="Expression"/>    
    /// </summary>
    public interface IExpressionSerializer
    {
        /// <summary>
        /// Serializes the <paramref name="expression"/> into a XML representation.
        /// </summary>
        /// <param name="expression">The <see cref="Expression"/> to serialize.</param>
        /// <returns>A <see cref="XElement"/> instance representing the serialized <see cref="Expression"/>.</returns>
        XElement Serialize(Expression expression);

        /// <summary>
        /// Deserializes the <paramref name="xmlExpression"/> into an <see cref="Expression"/> instance.
        /// </summary>
        /// <returns>A <see cref="Expression"/></returns>
        Expression Deseserialize(XElement xmlExpression);
    }
}
